import React, { Component } from 'react'
import qs from 'qs'

export default class Dtails extends Component {
  state = {
    DateDetails: [
      { id: '01', content: '你好，张国阳' },
      { id: '02', content: '徐毅' },
      { id: '03', content: '屈鑫' }
    ]
  }
  render() {
    //  接受params参数
     const { id, title } = this.props.match.params

    /*  接受query参数
     const { query } = this.props.location
     const { id, title } = qs.parse(query.slice(1)) */

    /* //接受state参数
    const { id, title } = this.props.location.state */
    
    const fiindResult = this.state.DateDetails.find((item) => {
      return item.id === id
    })
    return (
      <ul>
        <li>ID:{id}</li>
        <li>TITLE:{title}</li>
        <li>CONTENT:{fiindResult.content}</li>
      </ul>
    )
  }
}
